class Cloud {
    constructor(game) {
        this.game = game
        this.setUp()
    }

    setUp() {
        this.image = GuaImage.new(this.game, 'cloud')

        this.speed = randomBetween(3, 6)
        this.setPosition(randomBetween(0, config.screen_width), -randomBetween(50, 100))
    }

    static new(game) {
        var i = new this(game, name)
        return i
    }

    draw() {
        this.game.drawImage(this.image)
    }

    update() {
        this.moveDown()
    }

    moveDown() {
        if (this.image.y > 600) {
            this.setUp()
        }
        this.setPosition(this.image.x, this.image.y += this.speed)
    }

    setPosition(x, y) {
        this.image.setPosition(x, y)
    }
}